package javabase.schoolwork.day6_10;

/**
 * @author fance
 * @date 2018/6/10 13:46
 */
public class Producer implements Runnable {
    private Info info;

    public Producer(Info info) {
        this.info = info;
    }

    @Override
    public void run() {
        boolean flag = false;
        for (int i = 0; i < 50; i++) {
            if (flag) {
                try {
                    this.info.set("fance","boy");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

                flag = false;
            } else {
                try {
                    this.info.set("e xin","girl");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                flag = true;
            }
        }
    }
}
